<?php
namespace app\store\controller;
use app\store\model\Order as OrderModel;
use app\store\model\Recharge as RechargeModel;
use app\store\model\Shop as ShopModel;
use app\store\model\Pact as PactModel;
/**
 * 统计数据
 */
class Statistics extends Controller
{
	
    public function opt()
    {
		$model = new ShopModel;
	    $shoplist = $model->getList();
		return $this->fetch('opt', compact('shoplist'));
    }
	
	public function index($shop_id,$time_star,$time_end)
    {
		$shop['shop_id'] = $shop_id;
		$shop['star'] = strtotime($time_star);
		$shop['end'] = strtotime($time_end)+3600*24;
		$count = array();
		$count['order'] = OrderModel::getDateCount($shop);	//订单和收入统计
		$count['recharge'] = RechargeModel::getDateCount($shop);	//充值统计
		$count['pact'] = PactModel::getDateCount($shop);	//预约统计
		return $this->fetch('index', compact('count'));
    }
}
